<template>
  <div class="loginIndex">
    <!-- <div class="loginBox">
      <el-input size="large" class="w-50 m-2" placeholder="Please Input" />
      <el-input></el-input>
    </div> -->

    <div class="login-wrapper">
      <div class="header">SignIn Form</div>
      <div class="form-wrapper">
        <input type="text" name="username" placeholder="username" 
        class="input-item" v-model="id"/>
        <form>
          <input type="password" name="password" placeholder="password" class="input-item"
          v-model="password" autocomplete="" />
        </form>
        
        <!-- <div class="btn custom-hover">Login</div> -->
        <el-button class="btn" @click="login">Login</el-button>
      </div>
      <!-- <div class="msg">
        Don't have account?
        <a href="#">Sign up</a>
      </div> -->
    </div>
  </div>
</template>

<script setup name="login">
import { GET,POST } from '@/components/utils/http'
import { Encrypt } from '@/components/utils/api'
import { ref } from 'vue'
import { useWmsGlobal } from '@/store/wmsGlobal'
const wmsGlobal = useWmsGlobal();
const id = ref('57482053');
const password = ref("asd")
const emit = defineEmits(["login"])
const login = ()=>{
  const pw = Encrypt(password.value.trim())
  GET("/Login/login",{id:id.value,password:pw}).then(data=>{
    if(data.code === 200){
      wmsGlobal.isLogin = true;
    }
  })
}
</script>



<style lang="scss" scoped>
.loginIndex {
  position: absolute;
  width: 100%;
  height: 100%;
  background-image: url('/src/assets/main.jpg');
  background-size: cover;

  // display: flex;
  // justify-content: center;
  // align-items: center;
}
.loginBox {
  width: 500px;
  height: 300px;
  border-radius: 30px;
  background-color: white;
  box-shadow: 2px 2px 2px 1px rgba(0, 0, 0, 0.2);
}
.login-wrapper {
  background-color: #fff;
  width: 358px;
  height: 388px;
  border-radius: 15px;
  padding: 0 50px;
  position: relative;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}
.header {
  font-size: 28px;
  font-weight: bold;
  text-align: center;
  line-height: 100px;
}
.input-item {
  display: block;
  width: 100%;
  margin-bottom: 20px;
  border: 0;
  padding-bottom: 10px;
  border-bottom: 1px solid rgb(128, 125, 125);
  font-size: 20px;
  outline: none;
}
.input-item:placeholder {
  text-transform: uppercase;
}
.btn {
  text-align: center;
  // padding: 10px;
  width: 100%;
  // margin-top: 40px;
  background-image: linear-gradient(to right, #a6c1ee, #fbc2eb);
  color: #fff;
}
.msg {
  text-align: center;
  line-height: 88px;
}
a {
  text-decoration-line: none;
  color: #abc1ee;
}
</style> 